Skip to content
This repository was archived by the owner on Apr 6, 2019. It is now read-only.

Conversation

@Cylix
Copy link
Owner

@Cylix Cylix commented Aug 25, 2017

Cpp Redis changes in order to implement the Redis high availability and sentinel features.
This will need some time to code review everything, port windows changes to unix and test it.

Full credits to Mike Moeining for his amazing work!

MikesAracade and others added 6 commits August 14, 2017 14:37
//! ctor & dtor
#ifndef __CPP_REDIS_USE_CUSTOM_TCP_CLIENT
redis_connection(void);
redis_connection(std::uint32_t num_io_workers = 2);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to be ported to future_client too

typedef std::function<void(reply&)> reply_callback_t;
redis_client& set_callback_runner(const std::function<void(reply&, const reply_callback_t& callback)>& callback);
redis_client& send(const std::vector<std::string>& redis_cmd, const reply_callback_t& callback = nullptr);
virtual redis_client& send(const std::vector<std::string>& redis_cmd, const reply_callback_t& callback = nullptr);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check that

namespace cpp_redis {

class redis_subscriber {
friend class ha_redis_subscriber;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check that, kind of dislike use of friend. Is it necessary?

void connect(const std::string& host = "127.0.0.1", std::size_t port = 6379, const disconnection_handler_t& disconnection_handler = nullptr);
void disconnect(bool wait_for_removal = false);
bool is_connected(void);
virtual void connect(const std::string& host = "127.0.0.1", std::size_t port = 6379, const disconnection_handler_t& disconnection_handler = nullptr, std::uint32_t timeout_msecs = 0);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check uses of virtual

install_deps.sh Outdated
@@ -0,0 +1,12 @@
#!/bin/sh
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be removed

@MikesAracade
Copy link
Contributor

MikesAracade commented Aug 26, 2017 via email


redis_client&
redis_client::scan(int cursor, const std::string& pattern, int count, const reply_callback_t& reply_callback) {
if (pattern.size() > 0) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY

@MikesAracade
Copy link
Contributor

MikesAracade commented Aug 26, 2017 via email

#include <cpp_redis/redis_client.hpp>
#include <cpp_redis/redis_error.hpp>
#include <cpp_redis/redis_subscriber.hpp>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be changed


#include <cpp_redis/redis_client.hpp>
#include <cpp_redis/redis_error.hpp>

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not be changed

@MikesAracade
Copy link
Contributor

MikesAracade commented Aug 26, 2017 via email

…ke interface cleaner. rename redis_ prefix to classes
@Cylix Cylix changed the base branch from master to v4.x.x September 20, 2017 18:43
@Cylix
Copy link
Owner Author

Cylix commented Sep 20, 2017

This PR is now successfully reworked!

Considering the initial changes, here are the main changes:

  • ha_client is merged into client such that high availability can be used by any client easily.
  • ha_subscriber is merged into subscriber for the same reasons.
  • some small bugs have been fixed
  • client dont take number of io service workers as a parameter. Instead, io service num worker can be set from tcp_client or globally thanks to a dedicated function

Some other big changes not related to the original changes have been also brought and are listed in the CHANGELOG.

This will be released under 4.0.0.
I changed the base branch to be v4.x.x to temporarily hold the release on that branch the time to update the wiki doc, then it will be definitely merged onto master.

Please let me know if you have any feedbacks :)

Thanks again for your great work, it has been really inspiring and I believe it is a really meaningful and useful contribution to cpp_redis! So thanks a lot Mike, I really appreciate your constant involvement in this library!

Best :)

@Cylix Cylix merged commit f0a3dba into v4.x.x Sep 20, 2017
@Cylix Cylix deleted the high-availability-&-sentinel branch September 20, 2017 18:51
Cylix added a commit that referenced this pull request Sep 21, 2017
* High availability, sentinel, design improvement (#101)

* Added sentiel and high availability(HA) versions of client and subscriber which will handle connect/reconnection automatically to redis server.

* Merged changes

* clang format

* bump tacopie

* unix compilation. will need some time to code review and port windows changes to unix.

* clean unecessary changes. merge future_client into redis_client to make interface cleaner. rename redis_ prefix to classes

* merge ha_client into client, refactore architecture.

* merge ha_subscriber into subscriber

* try_commit instead of commit in disconnection flow

* doxygen

* tacopie link & documentation & compilation fix

* fix reconnection process

* fix unit tests

* clean code sentinel & make it consistent (avoid regression for example with callbacks execution)

* ability to change number of io service workers at runtime

* ha redis client example

* doxygen doc

* switch ZADD score param from map to multimap #107

* update CHANGELOG.md for 4.0.0 release

* bump tacopie

* [4.0.0] update README
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants